from application.enumeration.ContentTypeEnum import ContentTypeEnum
from application.model import TortoiseBaseModel
from tortoise.fields import CharField, BooleanField, BigIntField, CharEnumField


class CommentModel(TortoiseBaseModel):
    """
    评论表（一级评论）
    """
    user_id: int = BigIntField(null=False, description="用户ID")
    target_id: int = BigIntField(null=False, description="目标ID")
    content: str = CharField(max_length=280, null=False, description="评论内容，长度280，不能为空")
    content_type: str = CharEnumField(enum_type=ContentTypeEnum, max_length=5, null=True,
                                      description="评论的内容类型，帖子等等")
    is_disabled: bool = BooleanField(null=True, default=False, description="是否禁用")

    class Meta:
        table: str = "comment"
        table_description: str = "评论表 - 一级评论"
